SPB Git

Repository Public MIT

route.ts 757 B 15 lines typescript

1import { getDeck, getPreviewCourse } from "@/lib/content";2import { notFoundResponse } from "@/lib/serve";3import { serveDeckAsset } from "@/lib/slides-serve";4import { currentSession } from "@/lib/studio/guard";56export const dynamic = "force-dynamic";78/** Slide images of the working copy, for the private preview of a signed-in editor. */9async function handle(request: Request, { params }: { params: Promise<{ path: string[] }> }) {10  if (!(await currentSession())) return notFoundResponse();11  const path = (await params).path, session = (await getPreviewCourse()).sessions.find((s) => s.id === path[0]);12  return serveDeckAsset(session ? await getDeck(session) : null, path, request, "private, no-store");13}14export { handle as GET, handle as HEAD };15
Files main
Menu

Theme